<template>
  <div class="container">
    <div class="shotbox" style="height: 500px;padding-top: 100px;">
      <h1 style="text-align: center;margin-bottom: 50px;">证书查询</h1>
      <el-row type="flex" justify="center">
        <el-col :span="8">
          <el-form :model="ruleForm" status-icon label-width="100px" class="demo-ruleForm">
            <el-form-item label="身份证" prop="idCard">
              <el-input type="text" v-model="ruleForm.idCard" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="姓名" prop="name">
              <el-input type="text" v-model="ruleForm.name" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="证书编号" prop="cerfNumber">
              <el-input type="text" v-model="ruleForm.cerfNumber" autocomplete="off"></el-input>
            </el-form-item>
          </el-form>
          <div class="" style="text-align: center;">
            <el-button type="primary" @click="search">查询</el-button>
          </div>
        </el-col>
      </el-row>
    </div>
    <el-dialog  :close-on-click-modal="false"
      title="证书详情"
      :visible.sync="dialogVisible"
      width="30%">
      <!-- <el-table :data="cerfTable">
        <el-table-column prop="competitionName" label="获奖比赛"></el-table-column>
        <el-table-column prop="projectAndGroups" label="获奖项目"></el-table-column>
        <el-table-column prop="award" label="奖项"></el-table-column>
        <el-table-column prop="cerfNumber" label="证书编号"></el-table-column>
        <el-table-column prop="unit" label="所属单位"></el-table-column>
      </el-table> -->
      <!-- <el-descriptions class="margin-top" :column="3" border>
        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-user"></i>
            姓名
          </template>
          {{ cerfTable.name }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-mobile-phone"></i>
            身份证号
          </template>
          {{ cerfTable.idCard }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-location-outline"></i>
            性别
          </template>
          {{ cerfTable.sex }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-tickets"></i>
            比赛名称
          </template>
          <el-tag size="small">{{ cerfTable.competitionName }}</el-tag>
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-office-building"></i>
            比赛组别
          </template>
          {{ cerfTable.projectAndGroups }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-office-building"></i>
            获奖等级
          </template>
          {{ cerfTable.award }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-office-building"></i>
            颁奖单位
          </template>
          {{ cerfTable.approveUnit }}
        </el-descriptions-item>
        <el-descriptions-item>
          <template slot="label">
            <i class="el-icon-office-building"></i>
            颁奖时间
          </template>
          {{ cerfTable.approveDate }}
        </el-descriptions-item>
        <template slot="label">
            <i class="el-icon-office-building"></i>
            证书编号
          </template>
          {{ cerfTable.cerfNumber }}
        </el-descriptions-item>
      </el-descriptions> -->

      <el-row>
        <el-col :span="8">
          <el-row>
            <el-col :span="12">
              <div class="dis-cell">
                <!-- <i class="el-icon-user"></i> -->
                姓名
              </div>
            </el-col>
            <el-col :span="12">
              <div class="dis-body">
                {{ cerfTable.name }}
              </div>
            </el-col>
          </el-row>
        </el-col>
        <el-col :span="8">
          <el-row>
            <el-col :span="7">
              <div class="dis-cell">
                <!-- <i class="el-icon-user"></i> -->
                身份证
              </div>
            </el-col>
            <el-col :span="17">
              <div class="dis-body">
                {{ cerfTable.idCard }}
                <!-- 370283199204140053 -->
              </div>
            </el-col>
          </el-row>
        </el-col>
        <el-col :span="8">
          <el-row>
            <el-col :span="12">
              <div class="dis-cell">
                <!-- <i class="el-icon-user"></i> -->
                性别
              </div>
            </el-col>
            <el-col :span="12">
              <div class="dis-body">
                {{ cerfTable.sex }}
              </div>
            </el-col>
          </el-row>
        </el-col>
        <el-col :span="12">
          <el-row>
            <el-col :span="8">
              <div class="dis-cell">
                <!-- <i class="el-icon-user"></i> -->
                比赛名称
              </div>
            </el-col>
            <el-col :span="16">
              <div class="dis-body">
                {{ cerfTable.competitionName }}
              </div>
            </el-col>
          </el-row>
        </el-col>
        <el-col :span="12">
          <el-row>
            <el-col :span="8">
              <div class="dis-cell">
                <!-- <i class="el-icon-user"></i> -->
                颁奖单位
              </div>
            </el-col>
            <el-col :span="16">
              <div class="dis-body">
                {{ cerfTable.approveUnit }}
              </div>
            </el-col>
          </el-row>
        </el-col>
        <el-col :span="8">
          <el-row>
            <el-col :span="12">
              <div class="dis-cell">
                <!-- <i class="el-icon-user"></i> -->
                比赛组别
              </div>
            </el-col>
            <el-col :span="12">
              <div class="dis-body">
                {{ cerfTable.projectAndGroups }}
              </div>
            </el-col>
          </el-row>
        </el-col>
        <el-col :span="8">
          <el-row>
            <el-col :span="12">
              <div class="dis-cell">
                <!-- <i class="el-icon-user"></i> -->
                获奖等级
              </div>
            </el-col>
            <el-col :span="12">
              <div class="dis-body">
                {{ cerfTable.award }}
              </div>
            </el-col>
          </el-row>
        </el-col>
        <el-col :span="8">
          <el-row>
            <el-col :span="12">
              <div class="dis-cell">
                <!-- <i class="el-icon-user"></i> -->
                颁奖时间
              </div>
            </el-col>
            <el-col :span="12">
              <div class="dis-body">
                {{ cerfTable.approveDate }}
              </div>
            </el-col>
          </el-row>
        </el-col>
        <el-col :span="8">
          <el-row>
            <el-col :span="12">
              <div class="dis-cell">
                <!-- <i class="el-icon-user"></i> -->
                证书编号
              </div>
            </el-col>
            <el-col :span="12">
              <div class="dis-body">
                {{ cerfTable.cerfNumber }}
              </div>
            </el-col>
          </el-row>
        </el-col>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import {searchCertificate} from '@/api/search'
export default {
  data() {
    return {
      ruleForm:{
        idCard:'',
        name:'',
        cerfNumber:''
      },
      dialogVisible:false,
      cerfTable:{
        name:'姓名',
        idCard:'370283199200000000',
        sex:'性别',
        competitionName:'健美操新周期',
        projectAndGroups:'组别',
        award:'等级',
        approveUnit:'颁奖单位',
        approveDate:'颁奖时间',
        cerfNumber:'202237xxxx'
      }
    }
  },
  methods:{
    search() {
      if(this.ruleForm.idCard == '') {
        this.$message.error('请输入身份证')
      } else if(this.ruleForm.name == '') {
        this.$message.error('请输入姓名')
      } else if(this.ruleForm.cerfNumber == '') {
        this.$message.error('请输入证书编号')
      } else {
        let params = {
          idCard:this.ruleForm.idCard,
          name:this.ruleForm.name,
          cerfNumber:this.ruleForm.cerfNumber
        }
        searchCertificate(params).then(res => {
          if(res.code == 200) {
            this.cerfTable = res.data
            this.dialogVisible =true
          }
        }).catch(err => {
          console.log(err)
        })
      }
    }
  }
}
</script>
<style scoped>
.dis-cell {
  border: 1px solid #EBEEF5;
  padding: 12px 10px;
  box-sizing: border-box;
  text-align: left;
  font-weight: 400;
  line-height: 1.5;
  font-weight: 700;
  color: #909399;
  background: #fafafa;
}
.dis-cell i {
  font-family: element-icons!important;
  /* speak: none; */
  font-style: normal;
  font-weight: 400;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  vertical-align: baseline;
  display: inline-block;
}
.dis-body {
  border: 1px solid #ebeef5;
    padding: 12px 10px;
    box-sizing: border-box;
    text-align: left;
    font-weight: 400;
    line-height: 1.5;
}
</style>